home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1999 May / SGI IRIX 6.5 Applications 1999 May.iso / dist / nss_fasttrack.idb / var / netscape / fasttrack / include / nsacl / nserrdef.h.z / nserrdef.h
C/C++ Source or Header  |  1998-10-13  |  4KB  |  106 lines

  1. /*
  2.    PROPRIETARY SOURCE CODE OF NETSCAPE COMMUNICATIONS CORPORATION.
  3.  
  4.    Copyright (c) 1996 and 1997 Netscape Communications Corporation.
  5.    All rights reserved.
  6.  
  7.    Use of this Source Code is subject to the terms of the applicable
  8.    license agreement from Netscape Communications Corporation.
  9. */
  10.  
  11. #ifndef PUBLIC_NSACL_NSERRDEF_H
  12. #define PUBLIC_NSACL_NSERRDEF_H
  13.  
  14. /*
  15.  * Type:        NSEFrame_t
  16.  *
  17.  * Description:
  18.  *
  19.  *    This type describes the structure of an error frame.  An error
  20.  *    frame contains the following items:
  21.  *
  22.  *    ef_retcode    - This is a copy of the traditional error code,
  23.  *              as might be returned as a function value to
  24.  *              indicate an error.  The purpose of the error
  25.  *              code is to provide the caller of a function
  26.  *              with sufficient information to determine how
  27.  *              to process the error.  That is, it does not
  28.  *              need to identify a specific error, but only
  29.  *              has to distinguish between classes of errors
  30.  *              as needed by the caller to respond differently.
  31.  *              Usually this should be a small number of values.
  32.  *
  33.  *    ef_errorid    - This is an integer identifier which uniquely
  34.  *              identifies errors in a module or library.
  35.  *              That is, there should be only one place in
  36.  *              the source code of the module or library which
  37.  *              generates a particular error id.  The error id
  38.  *              is used to select an error message in an error
  39.  *              message file.
  40.  *
  41.  *    ef_program    - This is a pointer to a string which identifies
  42.  *              the module or library context of ef_errorid.
  43.  *              The string is used to construct the name of
  44.  *              the message file in which an error message for
  45.  *              ef_errorid can be found.
  46.  *
  47.  *    ef_errc        - This is the number of values stored in ef_errc[]
  48.  *              for the current error id.
  49.  *
  50.  *    ef_errv        - This is an array of strings which are relevant
  51.  *              to a particular error id.  These strings can
  52.  *              be included in an error message retrieved from
  53.  *              a message file.  The strings in a message file
  54.  *              can contain "%s" sprintf() format codes.  The
  55.  *              ef_errv[] strings are passed to sprintf() along
  56.  *              with the error message string.
  57.  */
  58.  
  59. #define NSERRMAXARG    8    /* size of ef_errv[] */
  60.  
  61. typedef struct NSEFrame_s NSEFrame_t;
  62. struct NSEFrame_s {
  63.     NSEFrame_t * ef_next;    /* next error frame on NSErr_t list */
  64.     long ef_retcode;        /* error return code */
  65.     long ef_errorid;        /* error unique identifier */
  66.     char * ef_program;        /* context for ef_errorid */
  67.     int ef_errc;        /* number of strings in ef_errv[] */
  68.     char * ef_errv[NSERRMAXARG];/* arguments for formatting error message */
  69. };
  70.  
  71. /*
  72.  * Description (NSErr_t)
  73.  *
  74.  *    This type describes the structure of a header for a list of
  75.  *    error frames.  The header contains a pointer to the first
  76.  *    and last error frames on the list.  The first error frame
  77.  *    is normally the one most recently generated, which usually
  78.  *    represents the highest-level interpretation available for an
  79.  *    error that is propogating upward in a call chain.  These
  80.  *    structures are generally allocated as automatic or static
  81.  *    variables.
  82.  */
  83.  
  84. typedef struct NSErr_s NSErr_t;
  85. struct NSErr_s {
  86.     NSEFrame_t * err_first;            /* first error frame */
  87.     NSEFrame_t * err_last;            /* last error frame */
  88.     NSEFrame_t *(*err_falloc)(NSErr_t * errp);    /* error frame allocator */
  89.     void (*err_ffree)(NSErr_t * errp,
  90.               NSEFrame_t * efp);    /* error frame deallocator */
  91. };
  92.  
  93. /* Define an initializer for an NSErr_t */
  94. #define NSERRINIT    { 0, 0, 0, 0 }
  95.  
  96. #ifndef INTNSACL
  97.  
  98. #define nserrDispose (*__nsacl_table->f_nserrDispose)
  99. #define nserrFAlloc (*__nsacl_table->f_nserrFAlloc)
  100. #define nserrFFree (*__nsacl_table->f_nserrFFree)
  101. #define nserrGenerate (*__nsacl_table->f_nserrGenerate)
  102.  
  103. #endif /* !INTNSACL */
  104.  
  105. #endif /* !PUBLIC_NSACL_NSERRDEF_H */
  106.